﻿using Mapster;
using Microsoft.VisualBasic;
using Npoi.Mapper.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TulingMember.Application.Util;
using TulingMember.Core;

namespace TulingMember.Application
{
    public class ProductDto : BaseEntityDto
    {
        /// <summary>
        /// 
        /// </summary>
        public string Code { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public string Specification { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string Unit { get; set; }
        public long TypeId { get; set; }
        public string TypeName { get; set; }
        /// <summary>
        /// 价格
        /// </summary>
        public decimal Price { get; set; }
        /// <summary>
        /// 采购价格
        /// </summary>
        public decimal InPrice { get; set; }
        /// <summary>
        /// 划线价格
        /// </summary>
        public decimal FakePrice { get; set; }
        /// <summary>
        /// 检索码
        /// </summary>
        public string SearchCode { get; set; }
        /// <summary>
        /// 生产厂家
        /// </summary>
        public string Manufacturer { get; set; }
        /// <summary>
        /// 库存下限
        /// </summary>
        public int StockLowerLimit { get; set; }
        /// <summary>
        /// 库存上限
        /// </summary>
        public int StockUpperLimit { get; set; }
        /// <summary>
        /// 剂型
        /// </summary>
        public string Formulations { get; set; }

        /// <summary>
        /// 库存数量
        /// </summary>
        public decimal Num { get; set; }
        /// <summary>
        /// 批号/国药准字
        /// </summary>
        public string GuoyaoZhunzi { get; set; }
        /// <summary>
        /// 生产日期
        /// </summary>
        public DateTime ManufacturingDate { get; set; }
        /// <summary>
        /// 有效期至
        /// </summary>
        public DateTime ExpirationDate { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 是否过期
        /// </summary>
        public bool IsExprired => DateTimeHelper.IsExpriredByDay(ExpirationDate, 180);

        /// <summary>
        /// 是否临期1个月
        /// </summary>
        public bool IsAdvent => DateTimeHelper.IsAdventByDay(ExpirationDate, 30);

    }

    public class ProductExport
    {
        [Column("药名")]
        public string Name { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        [Column("规格")]
        public string Specification { get; set; }

        /// <summary>
        /// 有效期至
        /// </summary>
        [Column("有效期至")]
        public DateTime ExpirationDate { get; set; }

        /// <summary>
        /// 库存数量
        /// </summary>
        [Column("库存数量")]
        public decimal Num { get; set; }

        /// <summary>
        /// 剂型
        /// </summary>
        [Column("剂型")]
        public string Formulations { get; set; }

        /// <summary>
        /// 生产厂家
        /// </summary>
        [Column("生产厂家")]
        public string Manufacturer { get; set; }

        /// <summary>
        /// 价格
        /// </summary>
        [Column("价格")]
        public decimal Price { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        [Column("单位")]
        public string Unit { get; set; }


    }
}
